<template>
    <!-- pages/health/sports/clockIn/jurisdiction/jurisdiction.wxml -->
    <view class="background">
        <view class="inline"></view>
        <view class="setJurisdiction" @tap="change0">
            <view class="setImg">
                <image :class="showview[0] ? 'setImg' : 'hide'" src="https://s4.ax1x.com/2022/03/05/b03O0K.png"></image>
            </view>
            <text class="jurisdictionText">公开</text>
        </view>
        <view class="setJurisdiction" @tap="change1">
            <view class="setImg">
                <image :class="showview[1] ? 'setImg' : 'hide'" src="https://s4.ax1x.com/2022/03/05/b03O0K.png"></image>
            </view>
            <text class="jurisdictionText">仅自己</text>
        </view>
        <view class="setJurisdiction" @tap="change2">
            <view class="setImg">
                <image :class="showview[2] ? 'setImg' : 'hide'" src="https://s4.ax1x.com/2022/03/05/b03O0K.png"></image>
            </view>
            <text class="jurisdictionText">仅搭档</text>
        </view>
        <button class="returnButton" @tap="returnData">
            <text class="returnText" style="position: relative; left: 4rpx; top: 15rpx; font-size: x-large; font-weight: normal">保存并返回</text>
        </button>
    </view>
</template>

<script>
// pages/health/sports/clockIn/jurisdiction/jurisdiction.js
export default {
    data() {
        return {
            showview: [1, 0, 0],
        };
    }
    /**
     * 生命周期函数--监听页面加载
     */,
    onLoad: function (options) {},
    /**
     * 生命周期函数--监听页面初次渲染完成
     */
    onReady: function () {},
    /**
     * 生命周期函数--监听页面显示
     */
    onShow: function () {},
    /**
     * 生命周期函数--监听页面隐藏
     */
    onHide: function () {},
    /**
     * 生命周期函数--监听页面卸载
     */
    onUnload: function () {},
    /**
     * 页面相关事件处理函数--监听用户下拉动作
     */
    onPullDownRefresh: function () {},
    /**
     * 页面上拉触底事件的处理函数
     */
    onReachBottom: function () {},
    /**
     * 用户点击右上角分享
     */
    onShareAppMessage: function () {},
    methods: {
        change0: function () {
            let num = 'showview[' + 0 + ']';
            this.setData({
                showview: [1, 0, 0]
            });
        },

        change1: function () {
            let num = 'showview[' + 1 + ']';
            this.setData({
                showview: [0, 1, 0]
            });
        },

        change2: function () {
            let num = 'showview[' + 2 + ']';
            this.setData({
                showview: [0, 0, 1]
            });
        },

        returnData: function () {
			var str="公开"
            if(this.showview[0]==1)		str="公开"
			if(this.showview[1]==1)		str="仅自己"
			if(this.showview[2]==1)		str="仅搭档"
			var pages=getCurrentPages();
			var prevpage=pages[pages.length-2];
			var indexUrl='pages/health/sports/clockIn/clockIn';
			var delta=1;
			for(var i=1;i<pages.length;i++)
			{
				if(indexUrl==pages[pages.length-i].route)
				{
					delta=i-1
					prevpage=pages[pages.length-i]
				}
			};
			prevpage.setData({
				who:str
			})
            uni.navigateBack({
            	delta:delta
            });
        }
    }
};
</script>
<style>
@import './jurisdiction.css';
</style>